package com.study.english.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.study.english.pojo.vo.SysVideoUserLogVo;
import com.study.english.result.Result;
import com.study.english.service.ISysVideoUserLogService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

import com.study.english.domain.SysVideoUserLog;

import org.springframework.web.bind.annotation.*;

/**
 * @author wf
 * @description 针对表【sys_video_user_log】的数据库操作Controller
 * @createDate 2024-03-11 15:56:35
 */
@RestController
@RequestMapping("sysVideoUserLog")
public class SysVideoUserLogController {

    @Autowired
    private ISysVideoUserLogService sysVideoUserLogService;


    /**
     * 新增:
     */
    @PostMapping("addSysVideoUserLog")
    public Result addSysVideoUserLog(@RequestBody SysVideoUserLogVo sysVideoUserLogVo) {
        sysVideoUserLogService.addSysVideoUserLog(sysVideoUserLogVo);
        return Result.success();

    }


    /**
     * 分页查询:
     */
    @PostMapping("getSysVideoUserLogPageList")
    public Result getSysVideoUserLogPageList(@RequestBody SysVideoUserLogVo sysVideoUserLogVo) {

        IPage<SysVideoUserLogVo> page = new Page<>(sysVideoUserLogVo.getPageNum(), sysVideoUserLogVo.getPageSize());
        IPage<SysVideoUserLogVo> list = sysVideoUserLogService.getSysVideoUserLogPageList(page, sysVideoUserLogVo);
        return Result.success(list);
    }


    /**
     * 不分页查询:
     */

    @PostMapping("getSysVideoUserLogList")
    public Result getSysVideoUserLogList(@RequestBody SysVideoUserLogVo sysVideoUserLogVo) {
        List<SysVideoUserLogVo> sysVideoUserLogVoList = sysVideoUserLogService.getSysVideoUserLogList(sysVideoUserLogVo);

        return Result.success(sysVideoUserLogVoList);
    }

    /**
     * 根据id查询详情:
     */

    @GetMapping("getSysVideoUserLogById")
    public Result getSysVideoUserLogById(@RequestParam String id) {
        SysVideoUserLog sysVideoUserLog = sysVideoUserLogService.getSysVideoUserLogById(id);
        return Result.success(sysVideoUserLog);
    }

    /**
     * 根据id删除:
     */
    @GetMapping("delSysVideoUserLog")
    public Result delSysVideoUserLog(@RequestParam String id) {
        sysVideoUserLogService.delSysVideoUserLog(id);
        return Result.success();
    }


    /**
     * 修改:
     */
    @PostMapping("updateSysVideoUserLog")
    public Result updateSysVideoUserLog(@RequestBody SysVideoUserLogVo sysVideoUserLogVo) {
        sysVideoUserLogService.updateSysVideoUserLog(sysVideoUserLogVo);
        return Result.success();

    }
}
